<script setup>
import { ref } from 'vue'
import Child from './components/Child.vue'
const money = ref(100)
const car = ref('玛莎拉蒂')
// 父组件能通过函数参数接收到子组件传出来的值
const changeMoney = (num) => {
  console.log('num', num)
  money.value = money.value - num
}
const changeCar = (value) => {
  console.log('car', value)
  car.value = value
}
</script>

<template>
  <div class="father-page">
    父组件
    <!-- vue2跟vue3父组件传值是一样的 -->
    <!-- 父组件接收子组件传值 vue3跟vue2语法一致 -->
    <Child :money="money" :car="car" @change-money="changeMoney" @changeCar="changeCar"></Child>
  </div>
</template>

<style scoped></style>
